package com.hrm.model.daoimple;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.hrm.model.dao.EmployeeDAO;
import com.hrm.model.dto.insa.EmployeeDTO;
import com.hrm.model.dto.insa.FamilyDTO;

public class EmployeeDAOImple extends SqlMapClientDaoSupport implements EmployeeDAO{

	@Override
	public boolean insertEmployee(EmployeeDTO dto) {
		System.out.println(dto);
		try{
			this.getSqlMapClientTemplate().insert("EmployeeMap.insertEmployee", dto);
			return true;
		}catch (Exception e) {
			System.out.println("insertEmployee : "+e.getMessage());
			return false;
		}
		
		 
	}
	
	@Override
	public List getAllEmployee(EmployeeDTO dto) {
		return this.getSqlMapClientTemplate().queryForList("EmployeeMap.getAllEmployee", dto);
	}

	@Override
	public EmployeeDTO getEmployee(EmployeeDTO dto) {
		return (EmployeeDTO) this.getSqlMapClientTemplate().queryForObject("EmployeeMap.getEmployee", dto);
	}

	@Override
	public void updateEmployee(EmployeeDTO dto) {
		this.getSqlMapClientTemplate().update("EmployeeMap.updateEmployee", dto);
		
	}
	
	public void updateCamEmployee(EmployeeDTO dto){
		this.getSqlMapClientTemplate().update("EmployeeMap.updateCamEmployee", dto);
	}

}
